I currently build a back-end using NodeJs.
To make the route, I should code like this:
// sever.js
server.route({
path: '/some/path',
method: 'GET',
handler: (request, reply) => {
return reply.response('trick or treat');
}
})
If I make the route like this, there will be code completion when I type request or reply and show all of these properties, include the info. Because the intelliSense will recognize it as a member of server object(handler's parameters).
Now, I want to separate the main server and routes. Will be look like this:
// server.js
const routes = require('./routes');
server.routes(routes);
// routes.js
module.exports = [
{
path: '/some/path',
method: 'GET',
handler: (request, reply) => {
return reply.response('trick or treat');
}
},
...
];
Now, when I type request or reply, there is no code completion like before. What I wanted is how to make intelliSense recognise the request and reply as a member of server object so that there will be code completion, parameter info, etc.